#!/bin/bash
#H1--------H2
ip netns add H1
ip netns add H2
ip link add name H1_H2 type veth peer name H2_H1

#H1
ip link set H1_H2 netns H1
ip netns exec H1 bash -c \
'
	ip link add name vxlan0 type vxlan id 42 dstport 4789 remote 192.168.57.54 local 192.168.57.50 dev H1_H2
	ip addr add 192.168.57.50/24 dev H1_H2
	ip addr add 172.16.0.1/16 dev vxlan0

	ip link set lo up
	ip link set H1_H2 up
	ip link set vxlan0 up
'

#H2
ip link set H2_H1 netns H2
ip netns exec H2 bash -c \
'
	ip link add name vxlan0 type vxlan id 42 dstport 4789 remote 192.168.57.50 local 192.168.57.54 dev H2_H1
	ip addr add 192.168.57.54/24 dev H2_H1
	ip addr add 172.16.0.10/16 dev vxlan0

	ip link set lo up
	ip link set vxlan0 up
	ip link set H2_H1 up
'